from APP.app.tableparse.models.exceluser import ExcelUser
from sqlalchemy_crud_plus import CRUDPlus
from sqlalchemy.ext.asyncio import AsyncSession
from APP.app.tableparse.schemas.excel_user_schema import ExcelUserSchema

class CRUDExcelUser(CRUDPlus[ExcelUser]):

    async def create_excel_user(self, db: AsyncSession, obj_in:list[ExcelUserSchema]) -> list[ExcelUser]:
        
        users = [ExcelUser(**obj_in.model_dump()) for obj_in in obj_in]
        db.add_all(users)
        await db.flush()

        return users   


ExcelUserDao:CRUDExcelUser = CRUDExcelUser(ExcelUser)